package com.steven.sample.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.steven.sample.R;
import com.steven.sample.adapter.FirstAdapter;
import com.steven.sample.bean.First;

import java.util.ArrayList;

/**
 * description: ListActivity
 * author: Steven Xiao
 * date: 2017/3/3
 */
public class ListActivity extends AppCompatActivity {
    private ArrayList<First> mList;

    private RecyclerView mRVTest;
    private FirstAdapter mAdapter;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list);
        init();
    }


    private void init() {
        mList = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            First first = new First();
            first.setContent("item" + i);
            mList.add(first);
        }

        mRVTest = (RecyclerView) findViewById(R.id.list_rv_test);
        mAdapter = new FirstAdapter(this, mList);
        mRVTest.setLayoutManager(new LinearLayoutManager(this));
        mRVTest.setAdapter(mAdapter);
    }
}
